#include <stdio.h>
#include <unistd.h>

int main(void)
{
  const char *tf = "testfile";
  int fd = creat(tf, 00000);
  int a_res = access(tf, F_OK|R_OK|W_OK|X_OK);
  printf("%s:%d\n", tf, a_res);
  chmod(tf, 00700);
  //lchmod(tf, 00700);
  fchmod(fd, 00700);
  a_res = access(tf, F_OK|R_OK|W_OK|X_OK);
  printf("%s:%d\n", tf, a_res);
  chown(tf, 500, -1);
  return chmod(tf, 07777);
}
